// eslint-disable-next-line quotes
import JSEncrypt from "jsencrypt"

// 公钥
const publicKey = 'MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBALVolEbJYQEViGM4S6S6YGi9VoaGqJ7YQVfaFfwkaplkqUyw4+t1fLntj4s1m7TYcd8TCJaA1tnpde9Xhx5LrDcCAwEAAQ=='
// 私钥
const privateKey = 'MIIBVAIBADANBgkqhkiG9w0BAQEFAASCAT4wggE6AgEAAkEAtWiURslhARWIYzhLpLpgaL1WhoaonthBV9oV/CRqmWSpTLDj63V8ue2PizWbtNhx3xMIloDW2el171eHHkusNwIDAQABAkBaypxrUR5bjItWHTa+mwjlYt2LNpnt5g3OCjg2mYNAgWkCAsH9z5iu/0jEFXaEHCZFgyUinZilVweGjMAobsIBAiEA2VmlhBiHRU2rMjMrJ5mZ1GRKbFTWKkY3igEnzNEfGzkCIQDVqsXpL3PpAqzTM9cLwi+Me7WLukcO9TowIfo6QtFS7wIgI1jC5CKhDRI+fyF3KS9/ptzQhaGeWq2kpprdgB+aMXECIDDyNvYtFatqHncfaALckBHpgPQqTv7hNFw0XGMeTV9nAiEAsMapvovnmKJlZX/QsmAobYsr6cuabXHisaJJpkYZoNs='

// 加密
export function encrypt(txt) {
  const encryptor = new JSEncrypt()
  encryptor.setPublicKey(publicKey) // 设置公钥
  return encryptor.encrypt(txt) // 对数据进行加密
}

// 解密
export function decrypt(txt) {
  const encryptor = new JSEncrypt()
  encryptor.setPrivateKey(privateKey) // 设置私钥
  return encryptor.decrypt(txt) // 对数据进行解密
}